$anzahl = $db_zugriff->query_first("SELECT COUNT(*) FROM bb".$n."_avatars WHERE (groupid = '$user_group' OR groupid = 0) AND posts <= '$info[userposts]' AND userid = 0");
if($anzahl[0]) {
if(!$page) $page=1;
$pages=ceil($anzahl[0]/25);
$result = $db_zugriff->query("SELECT * FROM bb".$n."_avatars WHERE (groupid = '$user_group' OR groupid = 0) AND posts <= '$info[userposts]' AND userid = 0 ORDER BY name ASC LIMIT ".(25*($page-1)).", 25");
$buddylist = $db_zugriff->query("SELECT objectid, username FROM bb".$n."_object2user LEFT JOIN bb".$n."_user_table ON (bb".$n."_user_table.userid = bb".$n."_object2user.objectid) WHERE bb".$n."_object2user.userid='$user_id' AND buddylist = 1");
if(check_userobject($user_id,$buddylist[$i],"buddylist")) $db_zugriff->query("DELETE FROM bb".$n."_object2user WHERE userid = '$user_id' AND objectid = '$buddylist[$i]' AND buddylist = 1");
else $db_zugriff->query("INSERT INTO bb".$n."_object2user (userid,objectid,buddylist) VALUES ('$user_id','$buddylist[$i]','1')");
}
}
$buddylist = $db_zugriff->query("SELECT objectid, username FROM bb".$n."_object2user LEFT JOIN bb".$n."_user_table ON (bb".$n."_user_table.userid = bb".$n."_object2user.objectid) WHERE bb".$n."_object2user.userid='$user_id' AND buddylist = 1");
if(check_userobject($user_id,$ignorelist[$i],"ignorelist")) $db_zugriff->query("DELETE FROM bb".$n."_object2user WHERE userid = '$user_id' AND objectid = '$ignorelist[$i]' AND ignorelist = 1");
else $db_zugriff->query("INSERT INTO bb".$n."_object2user (userid,objectid,ignorelist) VALUES ('$user_id','$ignorelist[$i]','1')");
}
}
$ignorelist = $db_zugriff->query("SELECT objectid, username FROM bb".$n."_object2user LEFT JOIN bb".$n."_user_table ON (bb".$n."_user_table.userid = bb".$n."_object2user.objectid) WHERE bb".$n."_object2user.userid='$user_id' AND ignorelist = 1");
$thread_result = $db_zugriff->query("SELECT DISTINCT bb".$n."_threads.threadid, bb".$n."_threads.* FROM bb".$n."_threads, bb".$n."_object2user WHERE bb".$n."_object2user.objectid = bb".$n."_threads.threadid AND bb".$n."_object2user.userid = '$user_id' AND bb".$n."_object2user.favthreads = 1 ORDER by important DESC, timelastreply DESC");
$lastauthorid = $db_zugriff->query_first("SELECT userid FROM bb".$n."_posts WHERE threadparentid='$threads[threadid]' ORDER by posttime DESC LIMIT 1");